#include <bits/stdc++.h>
using namespace std;
#define int long long
int n,k;
vector<int>v;
unordered_map<int, int>mp;
bool check(int x,int y)
{
    return v[x]<=y;
}
int X(int x)
{
    int l=0,r=n,mid;
    while(l<r)
    {
        mid=(r-l)/2+l+1;
        if(check(mid,x))l=mid;
        else r=mid-1;
    }
    return l;
}
void solve()
{
	cin>>n>>k;
	v=vector<int>(n+1);
	for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        mp[v[i]]=1;
    }
	sort(v.begin()+1,v.end());
	int y=1;
    while(mp[y])y++;
    int t=k-1;
    int x=0;
    while(t--)
    {
        while(mp[y+x]||x!=(X(y+x)))x++;
        y+=x;
    }
    cout<<y;
}
signed main()
{
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);
	int T=1;
	//cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}